package com.hostmanagement.util.db;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBUtil {
	
	private static final String dbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
	private static final String dbUrl = "jdbc:microsoft:sqlserver://192.168.1.103:1433;DatabaseName=glen";
	private static final String userName = "glen";
	private static final String password = "password";
	
	
	public static Connection getConnection(){
		Connection conn = null;
		try{
			Class.forName(dbDriver);
			conn = DriverManager.getConnection(dbUrl,userName, password);
		}catch(Exception e){
			e.printStackTrace();
		}
		return conn;
	}
	
	public static void closeConnection(Connection conn){
		try{
			if(conn != null)
				conn.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	
}
